from pydantic import BaseModel
import datetime

from app.models.credit_transaction import TransactionType

# Shared properties
class CreditTransactionBase(BaseModel):
    amount: int
    type: TransactionType
    description: str | None = None
    related_job_id: int | None = None

# Properties to receive via API on creation
class CreditTransactionCreate(CreditTransactionBase):
    user_id: int

class CreditTransactionInDBBase(CreditTransactionBase):
    id: int
    user_id: int
    created_at: datetime.datetime

    class Config:
        from_attributes = True

# Additional properties to return via API
class CreditTransaction(CreditTransactionInDBBase):
    pass
